home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 81 / IOPROG_81.ISO / tips / Java / Eseguire operazioni in background / Prova.java < prev   
Encoding:
Java Source  |  2004-04-28  |  468 b   |  23 lines

  1. public class Prova {
  2.     private static class Job extends AbstractJob {
  3.         private int i;
  4.         public Job(int j) {
  5.             i = j;
  6.         }
  7.         public void execute() {
  8.             System.out.println(i);
  9.         }
  10.     }
  11.     public static void main(String[] args) {
  12.         BackgroundJobExecutor ex = new BackgroundJobExecutor();
  13.         ex.add(new Job(0));
  14.         ex.add(new Job(3));
  15.         ex.add(new Job(4));
  16.         ex.add(new Job(8));
  17.         ex.add(new Job(12));
  18.         ex.add(new Job(9));
  19.         ex.start();
  20.         ex.stop();
  21.     }
  22. }
  23.